from bs4 import  BeautifulSoup
from urllib.error import HTTPError
from urllib.request import urlopen
import re

def getHtml(url):
    try:
        html = urlopen(url)
    except HTTPError as e:
        print(e.msg)
        return
    return  html

def getLink(html):
    try:
        bsObj = BeautifulSoup(html, 'html.parser')
        link = bsObj.a
    except AttributeError:
        return
    if link != None:
        return link
    else:
        return '没有获取到链接'


